import request from '@/utils/request'

// 获取批量修改任务商品列表
export function paging(query) {
  return request({
    url: '/goods/projectGoodsBatchModifyTaskRecord/paging',
    method: 'get',
    params: query
  })
}
// 根据企业id和任务id，获取已选的商品id集合，全部
export function getGoodsIdListByTaskId(enterpriseId, taskId) {
  if (!enterpriseId) {
    return false
  }
  if (!taskId) {
    return false
  }
  return request({
    url: '/goods/projectGoodsBatchModifyTaskRecord/getProjectGoodsBatchModifyTaskRecordForPSList',
    method: 'get',
    params: {
      enterpriseId: enterpriseId,
      taskId: taskId
    }
  })
}

// 保存批量修改商品任务
export function saveProjectGoodsBatchModifyTaskRecord(data) {
  return request({
    url: '/goods/projectGoodsBatchModifyTaskRecord/save',
    method: 'post',
    data: data
  })
}
// 批量保存
export function saveBatchProjectGoodsBatchModifyTaskRecord(data) {
  return request({
    url: '/goods/projectGoodsBatchModifyTaskRecord/saveBatch',
    method: 'post',
    data: data
  })
}

// 删除批量修改商品任务
export function deleteProjectGoodsBatchModifyTaskRecord(recordId) {
  if (!recordId) {
    return false
  }
  return request({
    url: '/goods/projectGoodsBatchModifyTaskRecord/delete',
    method: 'post',
    params: {
      projectGoodsBatchModifyTaskRecordId: recordId
    }
  })
}

// 根据任务id，删除商品记录
export function deleteByTaskId(taskId) {
  console.log(taskId)
  if (taskId === undefined) {
    return false
  }
  return request({
    url: '/goods/projectGoodsBatchModifyTaskRecord/deleteByTaskId',
    method: 'post',
    params: {
      taskId: taskId
    }
  })
}
// 导入商品做批量修改
export function importGoodsForBatchModify(query) {
  return request({
    url: '/goods/projectGoodsBatchModifyTaskRecord/doImportGoodsForBatchModify',
    method: 'post',
    data: query
  })
}
